]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
lint: Allow marking variables/arguments as unused
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 28 Jan 2019 00:37:12 +0000 (01:37 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 23 Jul 2019 22:28:45 +0000 (00:28 +0200)
Unused variables or arguments can indicate bugs, but they can also
help document the code, in particular in case of signal handlers
and destructuring.

Account for this by keeping the error, but set up patterns that allow
us to opt out of if for individual variables/arguments. For arguments
we pick a '_' prefix, while for variables we go with a suffix instead,
to not accidentally exempt private module-scope variables.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627

lint/eslintrc-shell.json

index d8a940bbb7ced45f91506e75923ddc0ba76dc332..1cae2f4e7e6d655edb46189fb9735fc02ec0612b 100644 (file)
                 "afterColon": true
             }
         ],
+        "no-unused-vars": [
+            "error",
+            {
+                "argsIgnorePattern": "^_",
+                "varsIgnorePattern": "_$"
+            }
+        ],
         "object-curly-spacing": [
             "error",
             "always"